SolarDeclination Function

private function SolarDeclination(time) result(sdec)

Compute solar declination. The declination of the sun is the angle between the equator and a line drawn from the centre of the Earth to the centre of the sun.

References:

Iqbal, M.: An introduction to solar radiation, Academis Press Canada, Ontario, 1983.

Arguments

Type IntentOptional Attributes Name
type(DateTime), intent(in) :: time

Return Value real(kind=float)


Variables

Type Visibility Attributes Name Initial
real(kind=float), public :: dayAngle
integer(kind=short), public :: dn

Source Code

FUNCTION SolarDeclination &
!
(time) &
!
RESULT (sdec)
    
IMPLICIT NONE

!Arguments with intent(in):
TYPE (DateTime), INTENT(in) :: time

!local declarations:
REAL (KIND = float) :: sdec ![radians]
REAL (KIND = float) :: dayAngle ![radians]
INTEGER (KIND = short) :: dn !day number of the year


!------------------------------------end of declarations-----------------------

!day of year
dn = DayOfYear (time, 'noleap')

!day angle
dayAngle = 2. * pi * (dn -1)  / 365.

!declination
sdec = (0.006918 - 0.399912 * COS (dayAngle) + 0.070257 * SIN (dayAngle) - &
        0.006758 * COS (2 * dayAngle) + 0.000907 * SIN (2 * dayAngle) - &
        0.002697 * COS (3 * dayAngle) + 0.00148 * SIN (3 * dayAngle))
RETURN
END FUNCTION SolarDeclination